<template>
  <el-container style="justify-content: center">
    <div class="info-text" style="color: #3A71A8">用 户 信 息</div>
    <el-main class="info-main">
      <el-form  ref="form"  label-width="100px" v-loading="loading">
        <el-form-item label="用户ID：">
          <el-input v-model="authName" :disabled="true">
          </el-input>
        </el-form-item>
        <el-form-item label="用户名：">
          <el-input  v-model="name" :disabled="true">
          </el-input>
        </el-form-item>
        <el-form-item label="当前角色：">
          <el-input  v-model="roles.toString()" :disabled="true">
          </el-input>
        </el-form-item>
        <el-form-item label="用户生日：">
          <el-date-picker v-model="userDetail.birthday" type="datetime" format="yyyy-MM-dd HH:mm:ss" :disabled="true"/>
        </el-form-item>
        <el-form-item />
        <el-form-item />
        <el-form-item />
        <el-form-item />
        <el-form-item />
        <el-form-item >
          <el-button type="primary" style="width:65%">编 辑 信 息</el-button>
        </el-form-item>
      </el-form>
    </el-main>

  </el-container>

</template>

<script>
  import { mapGetters } from 'vuex'
  import { getInfo } from '@/api/user'

  export default {
    name: 'userInfo',
    computed: {
      ...mapGetters([
        'name',
        'roles',
        'authName'
      ]),
    },
    data(){
      return{
        loading: false,
        userDetail: {},
      }
    },

    created() {
      this.getUserInfo()
    },

    methods:{
      getUserInfo(){
        this.loading=true;
        getInfo().then(response =>{
          this.userDetail=response.data.personInfo
          this.loading = false;
        }).catch(err => {
          console.log(err)
          this.loading = false;
        })
      }
    }
  }
</script>

<style lang="scss">
  @import "../_styles/mobile-main";
</style>
